Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix saving large token supplies #201

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

kespinola
Copy link
Collaborator

@kespinola kespinola commented Jul 19, 2024

Issue

Supply is represented as a u64 on the Token but saved in the db as i64 which doesn't support the same number range. The previous code would save these large values as negative which triggers a condition in the API where supply must be > 0 .

An example case is BONK.
https://solana.fm/address/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263/transactions

Changes

  • Switch DB supply columns on asset and token tables to numeric.
  • Use decimal in code to represent the numeric type in postgres.

resolves #200

@kespinola kespinola requested a review from danenbm July 19, 2024 13:53
@kespinola
Copy link
Collaborator Author

kespinola commented Jul 23, 2024

plerkle=> SELECT COUNT(*) FROM asset WHERE supply < 0;
 count
-------
 29508
(1 row)
plerkle=> SELECT COUNT(*) FROM tokens WHERE supply < 0;
 count
-------
 32957
(1 row)

@kespinola kespinola merged commit 20460a2 into metaplex-foundation:main Jul 31, 2024
3 checks passed
@kespinola kespinola deleted the espi/fix-token-supply branch July 31, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect Supply Saved on Fungible Assets
2 participants